package com.dongdongshop.service.impl;

import com.dongdongshop.mapper.TbAreasMapper;
import com.dongdongshop.mapper.TbCitiesMapper;
import com.dongdongshop.mapper.TbProvincesMapper;
import com.dongdongshop.pojo.*;
import com.dongdongshop.service.TbProvincesServiceI;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
@com.alibaba.dubbo.config.annotation.Service
public class TbProvincesServiceImpl implements TbProvincesServiceI {

    @Autowired
    private TbProvincesMapper tbProvincesMapper;

    @Autowired
    private TbCitiesMapper tbCitiesMapper;

    @Autowired
    private TbAreasMapper tbAreasMapper;


    @Override
    public List<TbProvinces> getSheng() {
        return tbProvincesMapper.selectByExample(new TbProvincesExample());
    }

    @Override
    public List<TbCities> getShi(String pid) {
        TbCitiesExample example = new TbCitiesExample();
        TbCitiesExample.Criteria criteria = example.createCriteria();
        criteria.andProvinceidEqualTo(pid);
        return tbCitiesMapper.selectByExample(example);
    }

    @Override
    public List<TbAreas> getXian(String cid) {
        TbAreasExample example = new TbAreasExample();
        TbAreasExample.Criteria criteria = example.createCriteria();
        criteria.andCityidEqualTo(cid);
        return tbAreasMapper.selectByExample(example);
    }
}
